Fix reboot and reconfigure of HVM guests when they are configured with an
authorEwan Mellor <ewan@xensource.com>
Wed, 30 Aug 2006 01:53:48 +0000 (02:53 +0100)
committerEwan Mellor <ewan@xensource.com>
Wed, 30 Aug 2006 01:53:48 +0000 (02:53 +0100)
empty CD-ROM drive.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/image.py
tools/python/xen/xend/server/blkif.py

index ad8720e54b0dc1b6cc5c29b4418fd3eea7233f3c..141482f0656b899fd164805240bbeedf3158be39 100644 (file)
@@ -305,7 +305,7 @@ class HVMImageHandler(ImageHandler):
         for (name, info) in deviceConfig:
             if name == 'vbd':
                 uname = sxp.child_value(info, 'uname')
-                if 'file:' in uname:
+                if uname is not None and 'file:' in uname:
                     (_, vbdparam) = string.split(uname, ':', 1)
                     if not os.path.isfile(vbdparam):
                         raise VmError('Disk image does not exist: %s' %
index 0d895c71b74835f84206b605c1633ca031657684..886cc5610d84b0eb186fbe670c9d8b28bd48bc86 100644 (file)
@@ -52,10 +52,18 @@ class BlkifController(DevController):
         except ValueError:
             dev_type = "disk"
 
-        try:
-            (typ, params) = string.split(uname, ':', 1)
-        except ValueError:
-            (typ, params) = ("", "")
+        if uname is None:
+            if dev_type == 'cdrom':
+                (typ, params) = ("", "")
+            else:
+                raise VmError(
+                    'Block device must have physical details specified')
+        else:
+            try:
+                (typ, params) = string.split(uname, ':', 1)
+            except ValueError:
+                (typ, params) = ("", "")
+
         back = { 'dev'    : dev,
                  'type'   : typ,
                  'params' : params,